<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>组件的数据区与方法区</title>
    <script src="../../js/common/vue/vue.js"></script>
    <!--子传父就是通过函数调用传的-->
</head>
<body>
<div id="app">
    <cpn></cpn>
</div>
<template id="temp">
    <button v-on:click="add()">点击次数为：{{item}}</button>
</template>
<script>
    Vue.component('cpn', {
        template: '#temp',
        data: function () {
            return {
                item: 1
            }
        },
        methods: {
            add: function () {
                this.item++
            }
        }


    });
    new Vue({
        el: '#app',
        components: {}
    })
</script>
</body>
</html>